Skip to content

Comments

feat: pre-fetch docker image#36

Merged
tiurin merged 10 commits intomainfrom
prefetch-docker-image
Sep 8, 2025
Merged

feat: pre-fetch docker image#36
tiurin merged 10 commits intomainfrom
prefetch-docker-image

Conversation

@tiurin
Copy link
Collaborator

@tiurin tiurin commented Sep 8, 2025

Adds start pulling docker image if doesn't exist after CLI install. This saves user time as image is pulled anyway and first LocalStack run.

Reasoning:

If we start pulling docker image as a first thing in the setup process then docker pull consumes all the bandwidth and makes CLI download an order of magnitude longer.

But if we start pulling image right after the install step it still takes advantage of time that user spends in the rest of setup steps.

Options considered: start docker pull right after CLI is downloaded. This way we could take advantage of time spent in another modal - global/local selection. Trade off is that passing image pull progress from/to runInstallProcess is adding complexity that is not justified with 2-3 seconds saved.

@tiurin tiurin changed the title Pre-fetch docker image feat: pre-fetch docker image Sep 8, 2025
Copy link
Collaborator

@skyrpex skyrpex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job! Just some nits as always :)

If we start pulling docker image as a first thing in the setup process then `docker pull` consumes all the bandwidth and makes CLI download an order of magnitude longer.

If we start pulling image right after the install step it still takes advantage of time that user spends in the rest of setup steps.

Options considered: start `docker pull` right after CLI is downloaded. This way we could take advantage of time spent in another modal - global/local selection. Trade off is that passing image pull progress from/to runInstallProcess is adding complexity that is not justified with 2-3 seconds saved.
inspectDockerImage was returning only a limited version data.
If we need a generic inspect function later then we could extract it, right now there is no need as there is no other usage of inspect.
@tiurin tiurin force-pushed the prefetch-docker-image branch from 872188a to 878347d Compare September 8, 2025 11:10
@tiurin tiurin requested a review from skyrpex September 8, 2025 11:12
};
}

const LOCALSTACK_DOCKER_IMAGE = "localstack/localstack-pro";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can import this constant from utils/cli.ts as it's defined there too?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great point, let's make sure we download what we are going to use! 😄 Moved to global constants module.

Copy link
Collaborator

@anisaoshafi anisaoshafi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improvement, good job 🚀

Copy link
Collaborator

@skyrpex skyrpex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍🏻

@tiurin tiurin merged commit 00ff25a into main Sep 8, 2025
3 checks passed
@tiurin tiurin deleted the prefetch-docker-image branch September 8, 2025 12:57

if (!imagePulled) {
progress.report({
message: "Downloading LocalStack docker image...",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit capitalization: @tiurin "Docker" as a name is preferably capitalized

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, will fix it in one of the upcoming releases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants